<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="../common/jquery/jquery-3.4.1.js"></script>
<script type="text/javascript"
	src="../common/bootstrap/bootstrap-4.4.0-dist/js/bootstrap.js"></script>
<link href="../css/basic_layout.css" rel="stylesheet" type="text/css">
<link href="../css/common_style.css" rel="stylesheet" type="text/css">
<link href="../css/chuqi.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="../js/commonAll.js"></script>
<script type="text/javascript" src="../js/artDialog.js"></script>
<title>信息管理系统</title>
<style>
.alt td {
	background: black !important;
}

.btn_style {
	width: 98%;
	border: none;
	text-align: center;
}
.sub_div {
	width: 100%;
	text-align: center;
}
</style>
</head>
<body>
	<form id="submitForm" name="submitForm" action="" method="post">
		<input type="hidden" name="allIDCheck" value="" id="allIDCheck" /> <input
			type="hidden" name="fangyuanEntity.fyXqName" value="" id="fyXqName" />
		<div id="container">
			<div class="ui_content">
				<div class="ui_text_indent">
					<div id="box_border"></div>
				</div>
			</div>
			<div class="ui_content">
				<div class="ui_tb">
					<table class="table" width="100%" align="center">
						<tr>
							<td style="width: 50%;text-align: center;">姓名</td>
							<td style="width: 50%;"><input type="text" value=""
								id="name" class="btn_style" readOnly></td>
						</tr>
						<tr>
							<td style="width: 50%;text-align: center;">性别</td>
							<td style="width: 50%;"><input type="text" value="" id="sex"
								class="btn_style" readOnly></td>
						</tr>
						<tr>
							<td style="width: 50%;text-align: center;">手机号码</td>
							<td style="width: 50%;"><input type="text" value=""
								id="phone" class="btn_style"></td>
						</tr>
						<tr>
							<td style="width: 50%;text-align: center;">邮件</td>
							<td style="width: 50%;"><input type="text" value=""
								id="mail" class="btn_style"></td>
						</tr>
					</table>
				</div>
			</div>
		</div>
	</form>
	<div class="sub_div">
		<button onclick="sub()">提 交</button>
	</div>
</body>
<script type="text/javascript">
	var info;
	$(document).ready(function() {
		$.ajax({
			url : "select",
			success : function(result) {
				info = result[0];
				$("#name").val(info.teh_name);
				$("#sex").val(info.teh_sex);
				$("#phone").val(info.teh_phone);
				$("#mail").val(info.teh_email);
			},
			error : function(err) {
				alert("教师个人信息获取失败！")
			}
		});
	})

	function sub() {
		var data = {
			teh_id : info.teh_id,
			teh_name : info.teh_name,
			teh_sex : info.teh_sex,
			teh_phone : $("#phone").val(),
			teh_email : $("#mail").val()
		}
		$.ajax({
			url : "/Teacher/update",
			method : "post",
			data : data,
			dataType : "json",
			success : function(res) {
				alert("修改成功！");
				history.go(0);
			},
			error : function(err) {
				alert("修改失败！");
			}
		})
	}
</script>
</html>
